filtro <- function(a,b) {
  x <-c(rep(0,85),rep(1,86),rep(0,85))
  y <- rep(0,256)
  
  for (j in 2:256) {
    y[j] <- a*x[j]+b*y[j-1]
  }
  y
}

#plot(filtro(0.8,0.2),type="l",col="red")
#lines(filtro(0.2,0.8),type="l",col="blue")
#lines(filtro(0.5,0.5),type="l",col="green")

plot(Mod(fft(filtro(0.8,0.2))),type="l",col="red")
lines(Mod(fft(filtro(0.2,0.8))),type="l",col="blue")
lines(Mod(fft(filtro(0.5,0.5))),type="l",col="green")